package com.milestone.fitnesspersonaltrainer.view.activity;

import android.os.Bundle;

import com.milestone.fitnesspersonaltrainer.R;
import com.milestone.fitnesspersonaltrainer.base.BaseActivity;
import com.milestone.fitnesspersonaltrainer.base.BaseFragment;
import com.milestone.fitnesspersonaltrainer.base.BaseFragmentAdapter;
import com.milestone.fitnesspersonaltrainer.databinding.ActivityMainBinding;
import com.milestone.fitnesspersonaltrainer.listener.OnBaseNetworkListener;
import com.milestone.fitnesspersonaltrainer.vewmodel.MainViewModel;
import com.milestone.fitnesspersonaltrainer.view.fragment.CourseFragment;
import com.milestone.fitnesspersonaltrainer.view.fragment.DietFragment;
import com.milestone.fitnesspersonaltrainer.view.fragment.NewsFragment;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends BaseActivity<ActivityMainBinding, MainViewModel> {

    private List<BaseFragment> list = new ArrayList<>();

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected MainViewModel createViewModel() {
        return new MainViewModel();
    }

    @Override
    protected int getVariableId() {
        return 0;
    }

    @Override
    protected OnBaseNetworkListener getNetworkListener() {
        return null;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        initPara();
    }

    private void initPara() {
        binding.tabBar.
                setTitles("COURSE", "NEWS", "DIET").
                setNormalIcons(R.mipmap.icon_video_nor, R.mipmap.icon_news_nor, R.mipmap.icon_diet_nor).
                setSelectedIcons(R.mipmap.icon_video_sel, R.mipmap.icon_news_sel, R.mipmap.icon_diet_sel).generate();

        list.add(new CourseFragment());
        list.add(new NewsFragment());
        list.add(new DietFragment());
        binding.viewPager.setAdapter(new BaseFragmentAdapter(getSupportFragmentManager(), list));
        binding.tabBar.setContainer(binding.viewPager);

    }
}
